  <div id="page_message" class="page_mess_animate page_mess_error">
    
  </div>
<?php include_partial('global/navbar') ?>

<br/><br/>

<div class="safe_nav">
    <div class="wrap">
        <div class="safe_usr">
            <div class="user_static">
                <div class="item"><span class="alt user"><?php echo $user_name; ?></span></div>
                <div>
                    <span class="tit">登录密码</span>
                   <a href="javascript:void(0)" id="editpwdbtn">修改密码</a>
                    
                </div>
                <div class="item"><span class="tit">注册时间</span><span class="alt"><?php echo $created_at; ?></span></div>
            </div>
            <div class="safe_static">
                <div class="tit item">建议您启动全部安全设置，以保障账户和资金安全</div>
                <div class="item">
                    <div class="ft-l">账户安全</div>
                    <div class="progress ft-l">
                        <?php if($id_card==0 && $email=="0"):?>
                        <div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100" style="width:30%;background:#ff9600">
                            <span class="sr-only">40% Complete (success)</span>
                        </div>
                        <?php endif;?>
                         <?php if($id_card==0 && $email!="0"):?>
                        <div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100" style="width:70%;background:#ff9600">
                            <span class="sr-only">40% Complete (success)</span>
                        </div>
                        <?php endif;?>
                         <?php if($id_card!=0 && $email=="0"):?>
                        <div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100" style="width:70%;background:#ff9600">
                            <span class="sr-only">40% Complete (success)</span>
                        </div>
                        <?php endif;?>
                        <?php if($id_card!=0 && $email!="0"):?>
                        <div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100" style="width:100%;background:#ff9600">
                            <span class="sr-only">40% Complete (success)</span>
                        </div>
                        <?php endif;?>
                    </div>
                </div>
            </div>
        </div>
        
        <div class="safe_item">
            <div class="item" name="gotobindid">
                <div class="panel panel-primary" >
                    <div class="panel-heading">
                        <h3 class="panel-title">实名认证</h3>
                    </div>
                    <div class="panel-body" id="bindidnav">
                        
                            <div class="gobindnav">
                                
                                <?php if($id_card==0):?>
                                <div class="authicon pip">
                                </div>
                                <a href="javascript:void(0)">[去设置]</a>
                                <?php else:?>
                                <div class="authicon piped">
                                </div>
                                <div class="set_t">身份证号 <?php echo $rep_card."   ".$rep_name;; ?></div>
                                <div class="set_l"></div>
                                 
                                <?php endif;?>
                            </div>
                    </div>
                </div>
            </div>
            <div class="item" name="gotobindmobile">
                <div class="panel panel-primary">
                    <div class="panel-heading">
                        <h3 class="panel-title">绑定手机</h3>
                    </div>
                    <div class="panel-body" id="bindmobilenav">
                         <?php if($phone==0):?>
                            <div class="authicon mobile">
                            </div>
                            <a href="javascript:void(0)">[去设置]</a>
                            
                         <?php else:?>
                            <div class="authicon mobileed">
                            </div>
                            <div class="set_t">手机号 <?php echo $rep_phone; ?></div>
                            <div class="set_l"><a href="javascript:void(0)" id="editmobile">修改</a></div>
                         <?php endif;?>
                    </div>
                </div>
            </div>
            <div class="item last"  name="gotobindemail">
                <div class="panel panel-primary">
                    <div class="panel-heading">
                        <h3 class="panel-title">绑定邮箱</h3>
                    </div>
                    <div class="panel-body" id="bindemailnav">
                        <div class="gobindnav">
                        <?php if($email=="0"):?>
                            <div class="authicon email">
                            </div>
                            <a href="javascript:void(0)">[去设置]</a>
                        <?php else:?>
                            <div class="authicon emailed">
                            </div>
                           
                            <div class="set_t">邮箱 <?php echo $rep_email; ?></div>
                            <div class="set_l"><a href="javascript:void(0)" id="editemail">修改</a></div>
                            
                        <?php endif;?>
                        </div>      
                           
                    </div>
                </div>
            </div>
        </div>
        <div id="authview">
            <div class="panel panel-primary" id="pwd-mobile" <?php if($get_type == "4"):?>style="display: block;" <?php else: ?>style="display: none;"<?php endif;?> >
                <div class="panel-heading">
                    <h3 class="ft-l panel-title">登录密码修改</h3>
                    <span class="icon20_g ft-r icon_close hand" closeto="gotobindmobile"></span>
                </div>
                <div class="panel-body" id="editpwd">
                    <div class="title">为了您的账户安全，请定期更换登录密码，并确保登录密码设置与提现密码不同。</div>
                    <form class="form-horizontal" role="form" action="<?php url_for('user/security') ?>" id="modifypwd" method="POST">
                         <input type="hidden" value="3" name="type" />
                        <div class="form-group">
                            <label for="pwd" class="col-xs-2 control-label">*原密码 </label>
                            <div class="col-xs-4">
                                <input type="password" class="form-control" id="pwd" name="pwd" autocomplete="off" placeholder="请输入原密码">
                                <?php if ($sf_user->hasFlash('pwd_error')): ?>
                                <label for="pwd" class="errormsg"><?php echo $sf_user->getFlash('pwd_error') ?></label>
                                <?php endif;?>
                                <label for="pwd" id="pwdlabel" class="errormsg" style="display: none;"></label>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="newpwd" class="col-xs-2 control-label">*新密码</label>
                            <div class="col-xs-4">
                                <input type="password" class="form-control" id="newpwd" name="newpwd" autocomplete="off" placeholder="请输入新密码">
                                <label for="newpwd" id="newpwdlabel" class="errormsg" style="display: none;"></label>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="newpwd2" class="col-xs-2 control-label">*确认新密码</label>
                            <div class="col-xs-4">
                                <input type="password" class="form-control" id="newpwd2" name="newpwd2" autocomplete="off" placeholder="请确认新密码">
                                <label for="newpwd2" id="newpwd2label" class="errormsg" style="display: none;"></label>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-xs-offset-2 col-xs-4">
                                <button type="submit" class="btn btn-primary" id="uplaodpwdEdit">提交</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
            <div class="panel panel-primary" id="nav-id" <?php if($get_type == "1"):?>style="display: block;" <?php else: ?>style="display: none;"<?php endif;?>>
                <div class="panel-heading">
                    <h3 class="ft-l panel-title">实名认证</h3>
                    <span class="icon20_g ft-r icon_close hand" closeto="gotobindid"></span>
                </div>
                <div class="panel-body" id="bindid">
                    <div class="title">微美贷携手"全国公民身份证号码查询服务中心"（NCIIC）推出权威认证方式。</div>
                    <?php if($id_card==0):?>
                         <form class="form-horizontal" id="identityfrom" role="form" action="<?php url_for('user/security') ?>" method="POST">
                          <input type="hidden" value="1" name="type" />
                          <div class="form-group">
                              <label for="realname" class="col-xs-2 control-label">我的真实姓名 </label>
                              <div class="col-xs-4">
                                  <input type="text" class="form-control" id="realname" name="realname" placeholder="请输入真实姓名">
                              </div>
                          </div>
                          <div class="form-group">
                              <label for="idnum" class="col-xs-2 control-label">我的身份证号</label>
                              <div class="col-xs-4">
                                  <input type="text" class="form-control" id="idnum" name="idnum" placeholder="请输入身份证号">
                              </div>
                          </div>
                          <div class="form-group">
                              <div class="col-xs-offset-2 col-xs-4">
                                  <button type="submit" class="btn btn-primary" id="uplaodpwdId" >提交</button>
                              </div>
                          </div>
                      </form>
                    <?php else:?>
                      
                          <div class="form-group">
                              <label for="realname" class="col-xs-2 control-label">我的真实姓名 </label>
                              <div class="col-xs-4">
                                  <?php echo $rep_name; ?>
                              </div>
                          </div>
                          <div class="form-group">
                              <label for="idnum" class="col-xs-2 control-label">我的身份证号</label>
                              <div class="col-xs-4">
                                  <?php echo $rep_card; ?>
                              </div>
                          </div>
                         
                      
                    <?php endif;?>
                    
                </div>
            </div>
            <div class="panel panel-primary" <?php if($get_type == "3"):?>style="display: block;" <?php else: ?>style="display: none;"<?php endif;?> id="nav-mobile">
                <div class="panel-heading">
                    <h3 class="ft-l panel-title">绑定手机</h3>
                    <span class="icon20_g ft-r icon_close hand" closeto="gotobindmobile"></span>
                </div>
                <div class="panel-body" id="bindmobile">
                    <div class="panel-body">
                          <div class="title">通过原手机短信修改</div>
                          <div class="mobile-step"><div class="ft-l num">1</div><div class="ft-l font">验证原手机号码</div><div class="ft-l jt"></div><div class="ft-l num">2</div><div class="ft-l font">验证新手机号</div><div class="ft-l jt"></div><div class="ft-l num succ">√</div><div class="ft-l font">成功</div></div>
                          <form class="form-horizontal" role="form" action="<?php url_for('user/originalmobile') ?>" method="POST" id="originalmobilenav" >
                              <div class="form-group">
                                  <label for="mobile" class="col-xs-2 control-label">*原手机号码 </label>
                                  <div class="col-xs-4">
                                      <input type="text" id="mobile" name="mobile" class="form-control" value="" placeholder="请输入手机号码">
                                  </div>
                                  <div class="col-xs-3">
                                      <input type="button" class="btn btn-default y_zhen" id="getmobilecode" value="获取验证码">
                                  </div>
                              </div>
                              <div class="form-group">
                                  <label for="originalmobilecode" class="col-xs-2 control-label">*手机验证码</label>
                                  <div class="col-xs-4">
                                      <input type="text" class="form-control" id="originalmobilecode" name="originalmobilecode" placeholder="请输入手机验证码">
                                  </div>
                              </div>
                              <div class="form-group">
                                  <div class="col-xs-offset-2 col-xs-4">
                                      <button type="button" class="btn btn-primary" id="originalmobilebtn">下一步</button>
                                  </div>
                              </div>
                          </form>
                          <form class="form-horizontal" role="form" action="/user/bindnewmobile" method="POST" style="display: none;" id="newmobilenav" >
                              <div class="form-group">
                                  <label for="newmobile" class="col-xs-2 control-label">*新手机号码 </label>
                                  <div class="col-xs-4">
                                      <input type="tel" id="newmobile" name="newmobile" class="form-control" placeholder="请输入手机号码">
                                  </div>
                                  <div class="col-xs-3">
                                      <input type="button" class="btn btn-default y_zhen" id="getnewmobilecode" value="获取验证码">
                                  </div>
                              </div>
                              <div class="form-group">
                                  <label for="mobilecode" class="col-xs-2 control-label">*手机验证码</label>
                                  <div class="col-xs-4">
                                      <input type="text" class="form-control" id="newmobilecode" name="newmobilecode" placeholder="请输入手机验证码">
                                  </div>
                              </div>
                              <div class="form-group">
                                  <div class="col-xs-offset-2 col-xs-4">
                                      <button type="button" id="editbindmobile" class="btn btn-primary">提交</button>
                                  </div>
                              </div>
                          </form>
                          <div class="alt">如果您在操作过程中出现问题，请点击<a href="javascript:void(0)" onclick="openfeedback()">在线客服</a>，或拨打微美贷客服电话：400-875-6699</div>
                  </div>
                </div>
            </div>
            <div class="panel panel-primary" <?php if($get_type == "2"):?>style="display: block;" <?php else: ?>style="display: none;"<?php endif;?> id="nav-email">
                <div class="panel-heading">
                    <h3 class="ft-l panel-title">绑定邮箱</h3>
                    <span class="icon20_g ft-r icon_close hand" closeto="gotobindemail"></span>
                </div>
                
                <div class="panel-body" id="bindemail">
                    <?php if($email!="0"):?>
                            <div class="panel-body">
                               
                                <div class="mobile-step"><div class="ft-l num">1</div><div class="ft-l font">验证当前邮箱</div><div class="ft-l jt"></div><div class="ft-l num">2</div><div class="ft-l font">填写新邮箱</div><div class="ft-l jt"></div><div class="ft-l num succ">√</div><div class="ft-l font">成功</div></div>
                                <form class="form-horizontal" role="form" action="<?php url_for('user/originalemail') ?>" method="POST" id="oldmailform" >
                                    <div class="form-group">
                                        <label for="mobile" class="col-xs-2 control-label">*已验证邮箱 </label>
                                        <div class="col-xs-4">
                                            <input type="text" id="oldemail" name="oldemail" class="form-control" value="" placeholder="请输入邮箱">
                                        </div>
                                        <div class="col-xs-3">
                                            <input type="button" class="btn btn-default y_zhen" id="getoldemailcode" value="获取验证码">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label for="originaloldemailcode" class="col-xs-2 control-label">*验证码</label>
                                        <div class="col-xs-4">
                                            <input type="text" class="form-control" id="originaloldemailcode" name="originaloldemailcode" placeholder="请输入手机验证码">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <div class="col-xs-offset-2 col-xs-4">
                                            <button type="button" class="btn btn-primary" id="originaloldemailbtn">下一步</button>
                                        </div>
                                    </div>
                                </form>
                                <form class="form-horizontal" role="form" action="/user/bindnewmobile" method="POST" style="display: none;" id="newemailform" >
                                    <div class="form-group">
                                        <label for="newmobile" class="col-xs-2 control-label">*新邮箱地址 </label>
                                        <div class="col-xs-4">
                                            <input type="tel" id="newemail" name="newemail" class="form-control" placeholder="请输入邮箱">
                                        </div>
                                        <div class="col-xs-3">
                                            <input type="button" class="btn btn-default y_zhen" id="getnewemailcode" value="获取验证码">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label for="mobilecode" class="col-xs-2 control-label">*验证码</label>
                                        <div class="col-xs-4">
                                            <input type="text" class="form-control" id="newemailcode" name="newemailcode" placeholder="请输入邮箱验证码">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <div class="col-xs-offset-2 col-xs-4">
                                            <button type="button" id="editbindemail" class="btn btn-primary">提交</button>
                                        </div>
                                    </div>
                                </form>
                                <div class="alt">如果您在操作过程中出现问题，请点击<a href="javascript:void(0)" onclick="openfeedback()">在线客服</a>，或拨打微美贷客服电话：400-875-6699</div>
                        </div>
                    <?php else: ?>
                         <form id="binemailfrom" class="form-horizontal" role="form" action="<?php url_for('user/security') ?>" method="POST">
                          <input type="hidden" value="2" name="type" />
                          <div class="form-group">
                              <label for="email" class="col-xs-2 control-label">*您的邮箱 </label>
                              <div class="col-xs-4">
                                  <input type="text" class="form-control" id="email" name="email">
                              </div>
                              <div class="col-xs-3">
                                    <input type="button" class="btn btn-default y_zhen" id="getemailcode" datatype="1" value="获取验证码">
                              </div>
                          </div>
                          <div class="form-group">
                              <label for="emailcode" class="col-xs-2 control-label">*邮箱验证码</label>
                              <div class="col-xs-4">
                                  <input type="text" class="form-control" id="emailcode" name="emailcode" placeholder="请输入邮箱验证码">
                                  <?php if ($sf_user->hasFlash('email_error')): ?>
                                  <label for="emailcode" class="errormsg"><?php echo $sf_user->getFlash('email_error') ?></label>
                                  <?php endif;?>
                              </div>
                          </div>
                          <div class="form-group">
                              <div class="col-xs-offset-2 col-xs-4">
                                  <button type="submit" id="bindemailbtn" class="btn btn-primary">提交</button>
                              </div>
                          </div>
                      </form>
                      <div class="alt">如果您在操作过程中出现问题，请点击<a href="javascript:void(0)" onclick="openfeedback()">在线客服</a>，或拨打微美贷客服电话：400-875-6699</div>
                    <?php endif; ?>
                   
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript" src="./js/sco/sco.message.js"></script>
<script type="text/javascript">
    
    var bindview = new bindview();
    $("#10003 , #10012").addClass('on');
    //绑定邮箱，获取邮箱验证码
    $("#getemailcode").on('click', function () {
        var email = $("#email").val();
        
        if(!isEmail(email)){
            //alert('请输入正确邮箱！');
            $("#page_message").html('请输入正确邮箱！').show().fadeOut(2000);
            return false;
        }
        
        $.ajax({
             type: "POST",
             url: "<?php echo url_for('user/email_code'); ?>",
             data: "email=" + email,
             dataType:"json",
             success: function(data){
                 if(data.result == "error"){
                    $("#page_message").html(data.message).show().fadeOut(2000);
                    return false;
                 }
                 time(this);
               
             }   
        });
    })
    //修改手机，获取原来号码验证码
    $("#getmobilecode").on('click', function () {
        var mobile = $("#mobile").val();
        var oldmobile="<?php echo $phone; ?>";
       
        if(mobile.length < 11){
            //alert('手机号码长度错误！');
            $("#page_message").html('手机号码长度错误！').show().fadeOut(2000);
            return false;
        }
        
        if(mobile!=oldmobile){
            //alert('原手机号码不正确');
            $("#page_message").html('原手机号码不正确').show().fadeOut(2000);
            return false;
        }
        
        $.ajax({
             type: "POST",
             url: "<?php echo url_for('user/oldphonecode'); ?>",
             data: "mobile=" + mobile,
             dataType:"json",
             success: function(data){
                 if(data.result == "error"){
                    $("#page_message").html(data.message).show().fadeOut(2000);
                    return false;
                 }
                 time(this);
               
             }   
        });
    })
    
    
    
    //验证旧手机验证码
       $("#originalmobilebtn").on('click', function () {
        var mobile = $("#mobile").val();
        var originalmobilecode=$("#originalmobilecode").val();
         var oldmobile="<?php echo $phone; ?>";
        if(mobile.length < 11){
            //alert('手机号码错误！');
             $("#page_message").html('手机号码错误！').show().fadeOut(2000);
            return false;
        }
        
        if(mobile!=oldmobile){
            //alert('原手机号码不正确');
             $("#page_message").html('原手机号码不正确').show().fadeOut(2000);
            return false;
        }
        
        if(originalmobilecode.length < 6){
            //alert('手机验证码错误！');
             $("#page_message").html('手机验证码错误！').show().fadeOut(2000);
            return false;
        }
        
        $.ajax({
             type: "POST",
             url: "<?php echo url_for('user/originalmobile'); ?>",
             data: "mobile=" + mobile+"&originalmobilecode="+originalmobilecode+"&types=1",
             dataType:"json",
             success: function(data){
               alert(data.result);
                 if(data.result == "error" ){
                     $("#page_message").html(data.message).show().fadeOut(2000);
                     return false;
                  }else{
                    $("#page_message").html(data.message).hide();
                    $("#originalmobilenav").hide();
                    $("#newmobilenav").show();
                  }
               
             }   
        });
        
        })
        //获取新手机验证码
        $("#getnewmobilecode").on('click', function () {
        var newmobile = $("#newmobile").val();
        
        if(newmobile.length < 11){
            //alert('手机号码长度错误！');
            $("#page_message").html('手机号码长度错误！').show().fadeOut(2000);
            return false;
        }
        
        $.ajax({
             type: "POST",
             url: "<?php echo url_for('user/create_code'); ?>",
             data: "mobile=" + newmobile,
             dataType:"json",
             success: function(data){
                 if(data.result == "error"){
                    $("#page_message").html(data.message).show().fadeOut(2000);
                    return false;
                 }
                 time(this);
             }   
        });
      })
      
      //验证新手机验证码，并更改当前手机号码
      $("#editbindmobile").on('click', function () {
        var newmobile = $("#newmobile").val();
        var newmobilecode=$("#newmobilecode").val();
        
        if(mobile.length < 11){
           // alert('手机号码错误！');
            $("#page_message").html('手机号码错误！').show().fadeOut(2000);
            return false;
        }
        
        if(originalmobilecode.length < 4){
           // alert('手机验证码错误！');
            $("#page_message").html('手机验证码错误！').show().fadeOut(2000);
            return false;
        }
        
        $.ajax({
             type: "POST",
             url: "<?php echo url_for('user/originalmobile'); ?>",
             data: "mobile=" + newmobile+"&originalmobilecode="+newmobilecode+"&types=2",
             dataType:"json",
             success: function(data){
               
                 if(data.result == "error" ){
                    $("#page_message").html(data.message).show().fadeOut(2000);
                    return false;
                  }else{
                    location.reload();
                  }
               
             }   
        });
        
     })
    
    //修改邮箱，获取原来邮箱验证码
    $("#getoldemailcode").on('click', function () {
        var email = $("#oldemail").val();
        var oldemail="<?php echo $email; ?>";
       
        if(!isEmail(email)){
           // alert('请输入正确邮箱地址！');
             $("#page_message").html('请输入正确邮箱地址！').show().fadeOut(2000);
            return false;
        }
        
        if(email!=oldemail){
            //alert('原邮箱输入不正确');
             $("#page_message").html('原邮箱输入不正确').show().fadeOut(2000);
            return false;
        }
       
        $.ajax({
             type: "POST",
             url: "<?php echo url_for('user/oldemailcode'); ?>",
             data: "email=" + email,
             dataType:"json",
             success: function(data){
                 if(data.result == "error"){
                    $("#page_message").html(data.message).show().fadeOut(2000);
                    return false;
                 }
                 time(this);
             }   
        });
    })
    
    //验证旧邮箱验证码
       $("#originaloldemailbtn").on('click', function () {
       var email = $("#oldemail").val();
       var oldemail="<?php echo $email; ?>";
       var originaloldemailcode=$("#originaloldemailcode").val();
        if(!isEmail(email)){
           // alert('请输入正确邮箱地址！');
            $("#page_message").html("请输入正确邮箱地址！").show().fadeOut(2000);
            return false;
        }
        
        if(email!=oldemail){
            //alert('原邮箱输入不正确');
            $("#page_message").html("原邮箱输入不正确").show().fadeOut(2000);
            return false;
        }
        
        if(originaloldemailcode.length <4){
            //alert('输入验证码错误！');
            $("#page_message").html("输入验证码错误").show().fadeOut(2000);
            return false;
        }
        
        $.ajax({
             type: "POST",
             url: "<?php echo url_for('user/originalemail'); ?>",
             data: "email=" + email+"&originaloldemailcode="+originaloldemailcode+"&types=1",
             dataType:"json",
             success: function(data){
            
                 if(data.result == "error" ){
                    $("#page_message").html(data.message).show().fadeOut(2000);
                    return false;
                  }else{
                    $("#page_message").html(data.message).hide();
                    $("#oldmailform").hide();
                    $("#newemailform").show();
                  }
               
             }   
        });
        
        })
        
    //获取新邮箱验证码
    $("#getnewemailcode").on('click', function () {
        var email = $("#newemail").val();
        
        if(!isEmail(email)){
            //alert('请输入正确邮箱！');
            $("#page_message").html("请输入正确邮箱！").show().fadeOut(2000);
            return false;
        }
         
        $.ajax({
             type: "POST",
             url: "<?php echo url_for('user/email_code'); ?>",
             data: "email=" + email,
             dataType:"json",
             success: function(data){
                 if(data.result == "error"){
                    $("#page_message").html(data.message).show().fadeOut(2000);
                    return false;
                 }
                 time(this);
               
             }   
        });
    })
    
     //验证新邮箱验证码
       $("#editbindemail").on('click', function () {
       var email = $("#newemail").val();
      
       var originaloldemailcode=$("#newemailcode").val();
        if(!isEmail(email)){
            //alert('请输入正确邮箱地址！');
             $("#page_message").html('请输入正确邮箱地址！').show().fadeOut(2000);
            return false;
        }
        
        if(originaloldemailcode.length < 6){
            //alert('输入验证码错误！');
             $("#page_message").html('输入验证码错误！').show().fadeOut(2000);
            return false;
        }
        
        $.ajax({
             type: "POST",
             url: "<?php echo url_for('user/originalemail'); ?>",
             data: "email=" + email+"&originaloldemailcode="+originaloldemailcode+"&types=2",
             dataType:"json",
             success: function(data){
               alert(data.result);
                 if(data.result == "error" ){
                    $("#page_message").html(data.message).show();
                  }else{
                    location.reload();
                  }
               
             }   
        });
        
        })
    function isEmail(str){
       var reg = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,3}){1,2})$/;
       return reg.test(str);
    }
    
    $("#editpwdbtn").click(function (){

      $("#nav-id").hide();
      $("#nav-mobile").hide();
      $("#nav-email").hide();
      $("#pwd-mobile").show();
    });
    
    $("#uplaodpwdEdit").click(function(){
      var pwd=$("#pwd").val();

       if(pwd.length<8 || pwd.length>16){
        
        $("#pwdlabel").text("密码长度请保持在8至16位之间").show();
        return false;
       }

        var reg=new RegExp(/[A-Za-z].*[0-9]|[0-9].*[A-Za-z]/);
       if(!reg.test(pwd)){
        $("#pwdlabel").text("密码由字母，数字和特殊字符组成，且必须包含字母和数字").show();
         return false;
       }
       
       var newpwd=$("#newpwd").val();

       if(newpwd.length<8 || newpwd.length>16){
        
        $("#newpwdlabel").text("密码长度请保持在8至16位之间").show();
        return false;
       }

        var reg=new RegExp(/[A-Za-z].*[0-9]|[0-9].*[A-Za-z]/);
       if(!reg.test(newpwd)){
        $("#newpwdlabel").text("密码由字母，数字和特殊字符组成，且必须包含字母和数字").show();
        return false;
       }
       
       var newpwd2=$("#newpwd2").val();
     
       if(newpwd2.length<8 || newpwd2.length>16){
        
        $("#newpwd2label").text("密码长度请保持在8至16位之间").show();
        return false;
       }

        var reg=new RegExp(/[A-Za-z].*[0-9]|[0-9].*[A-Za-z]/);
       if(!reg.test(newpwd2)){
        $("#newpwd2label").text("密码由字母，数字和特殊字符组成，且必须包含字母和数字").show();
        return false;
       }
       
       if(newpwd!=newpwd2){
         $("#newpwd2label").text("新密码不一致，请确认").show();
          return false;
       }
       
       if(newpwd==pwd){
         $("#newpwdlabel").text("新旧密码不能相同，请确认").show();
          return false;
       }
       
       
       
    });
    
    $("#pwd").blur(function(){
      var pwd=$("#pwd").val();

       if(pwd.length<8 || pwd.length>16){
        
        $("#pwdlabel").text("密码长度请保持在8至16位之间").show();
        return false;
       }

        var reg=new RegExp(/[A-Za-z].*[0-9]|[0-9].*[A-Za-z]/);
       if(!reg.test(pwd)){
        $("#pwdlabel").text("密码由字母，数字和特殊字符组成，且必须包含字母和数字").show();
         return false;
       }
       
        $("#pwdlabel").hide();
    });
    
    $("#newpwd").blur(function(){
      var newpwd=$("#newpwd").val();

       if(newpwd.length<8 || newpwd.length>16){
        
        $("#newpwdlabel").text("密码长度请保持在8至16位之间").show();
        return false;
       }

        var reg=new RegExp(/[A-Za-z].*[0-9]|[0-9].*[A-Za-z]/);
       if(!reg.test(newpwd)){
        $("#newpwdlabel").text("密码由字母，数字和特殊字符组成，且必须包含字母和数字").show();
        return false;
       }
       
       $("#newpwdlabel").hide();
    });
    
    $("#newpwd2").blur(function(){
      var newpwd2=$("#newpwd2").val();
      var newpwd=$("#newpwd").val();
       if(newpwd2.length<8 || newpwd2.length>16){
        
        $("#newpwd2label").text("密码长度请保持在8至16位之间").show();
        return false;
       }

        var reg=new RegExp(/[A-Za-z].*[0-9]|[0-9].*[A-Za-z]/);
       if(!reg.test(newpwd2)){
        $("#newpwd2label").text("密码由字母，数字和特殊字符组成，且必须包含字母和数字").show();
        return false;
       }
       
       if(newpwd!=newpwd2){
         $("#newpwd2label").text("新密码不一致，请确认").show();
          return false;
       }
       
       $("#newpwd2label").hide();
    });
</script>

   <script type="text/javascript">  
    var wait=60;  
    function time(o) {  
            if (wait == 0) {  
                o.removeAttribute("disabled");            
                o.value="获取验证码";  
                wait = 60;  
            } else {  
                o.setAttribute("disabled", true);  
                o.value="重新发送(" + wait + ")";  
                wait--;  
                setTimeout(function() {  
                    time(o)  
                },  
                1000)  
            }  
        }  
  
    </script>  
